
package com.yungu.swift.system.marketing.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.base.mapper.IMapper;
import com.yungu.swift.base.service.impl.BaseServiceImpl;
import com.yungu.swift.system.marketing.dao.MarketingChannelStatisticsMapper;
import com.yungu.swift.system.marketing.model.dto.MarketingChannelStatisticsDto;
import com.yungu.swift.system.marketing.model.param.AdminChannelStatisticsPageParam;
import com.yungu.swift.system.marketing.model.vo.MarketingChannelStatisticsExportVo;
import com.yungu.swift.system.marketing.service.MarketingChannelStatisticsService;
import com.yungu.swift.utils.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 * @author xiuyin.cui - Generate
 * @version 1.1.0-SNAPSHOT
 * @since 2018-07-02 11:19
 */
@Service
public class MarketingChannelStatisticsServiceImpl extends BaseServiceImpl<MarketingChannelStatisticsDto> implements MarketingChannelStatisticsService {

    @Autowired
    private MarketingChannelStatisticsMapper marketingChannelStatisticsMapper;

    @Override
    protected IMapper<MarketingChannelStatisticsDto> getMapper() {
        return marketingChannelStatisticsMapper;
    }

    @Override
    public ResponseData<Integer> statisticsChannelPerson() {
        return ResponseData.buildSuccessResponse(marketingChannelStatisticsMapper.statisticsChannelPerson());
    }

    @Override
    public ResponseData<List<MarketingChannelStatisticsExportVo>> listExport(AdminChannelStatisticsPageParam
                                                                                         statisticsPageParam) {
        Map<String, Object> objectMap = MapUtils.convertObjToMap(statisticsPageParam);
        return ResponseData.buildSuccessResponse(marketingChannelStatisticsMapper.listExport(objectMap));
    }
}
